/**
 * chenuu.com
 * 
 * @author  zhaoxu.com@gmail.com
 * @created 2012-11-10
 */
package com.chenuu.integration.httpclient.dropbox;

import com.dropbox.client2.jsonextract.JsonExtractionException;
import com.dropbox.client2.jsonextract.JsonMap;
import com.dropbox.client2.jsonextract.JsonThing;

/**
 *
 */
public class CreatedCopyRef {
	public final String copyRef;
	public final String expiration;

	public CreatedCopyRef(String copyRef, String expiration) {
		this.copyRef = copyRef;
		this.expiration = expiration;
	}

	public static CreatedCopyRef extractFromJson(JsonThing j) throws JsonExtractionException {
		JsonMap m = j.expectMap();
		String string = m.get("copy_ref").expectString();
		String expiration = m.get("expires").expectString();
		return new CreatedCopyRef(string, expiration);
	}
}
